<template>
  <el-table
    :data="orderData"
    style="width: 100%">
    <el-table-column
      label="订单ID"
      >
      <template slot-scope="scope">
        <span style="margin-left: 10px">{{ scope.row.goodsId._id }}</span>
      </template>
    </el-table-column>
    <el-table-column
      label="商品名称"
     >
      <template slot-scope="scope">
            <el-tag size="medium">{{ scope.row.goodsId.name }}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      label="用户名"
      >
      <template slot-scope="scope">
        <el-tag size="medium">{{ scope.row.userId.name }}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      label="用户地址"
     >
      <template slot-scope="scope">
        <el-tag size="medium">{{ scope.row.userId.userAddress }}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      label="联系方式"
      >
      <template slot-scope="scope">
        <el-tag size="medium" >{{ scope.row.userId.userPhoneNumber }}</el-tag>
      </template>
    </el-table-column>

    
    
    <el-table-column
      label="状态"
      >
      <template  slot-scope="scope">
            <el-tag size="medium">{{ scope.row.status}}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      label="备注"
      >
      <template slot-scope="scope">
            <el-tag size="medium">{{ scope.row.remark }}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      label="数量"
     >
      <template slot-scope="scope">
            <el-tag size="medium">{{ scope.row.number }}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      label="用户是否删除"
      >
      <template slot-scope="scope">
            <el-tag size="medium">{{ scope.row.show }}</el-tag>
      </template>
    </el-table-column>

     <el-table-column
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button type="text" size="small" ><router-link :to='"/merchant/updataOrder/" + scope.row._id' >修改</router-link></el-button>
        <el-button type="text" size="small" @click='deleteOrderListOne(scope.row._id)'>删除</el-button>
      </template>
    </el-table-column>

  </el-table>
</template>

<script>
  import {createNamespacedHelpers} from 'vuex';
  const {mapState,mapActions,mapMutations,mapGetters}=createNamespacedHelpers('orderStore');
  import axios from 'axios'
  export default {
    data() {
      return {
      }
    },
    mounted(){
       this.getOrderList();
       
    },
  
    computed:{
      //获取所有订单
      ...mapState(['orderData']),

    },
    methods: {
       ...mapActions(['getOrderList','deleteOrderListOne']),
    
    },

    // watch: {
    //   orderData(newval,oldval){
    //     // console.log(newval,oldval);
    //     newval.map((item)=>{
    //       if(item.status==1){
    //         item.status='未发货'
    //       }else if(item.status==2){
    //          item.status='已发货'
    //       }else{
    //          item.status='已取消'
    //       };
    //       if(item.show==true){
    //         item.show='是'
    //       }else{
    //          item.show='否'
    //       }
    //     })
        
    //   },
    // },
  }
</script>
<style>
    .cell{
        text-align: center;
        color: black;
    }
</style>